{extend name="base:base" /}
{block name="body"}
<fieldset class="layui-elem-field layui-field-title mt-15">
    <legend>编辑导航</legend>
</fieldset>
<div class="layui-row">
    <div class="layui-col-xs12 layui-col-md6">
        <form class="layui-form" action="{:Url::build('renew')}" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">标题</label>
                <div class="layui-input-block">
                    <input type="text" name="title" lay-verify="required" lay-verify="title" autocomplete="off"
                           placeholder="用于显示的文字" value="{$info.title ?? ''}"
                           class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux"></div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">链接</label>
                <div class="layui-input-block">
                    <input type="text" name="url" lay-verify="required" placeholder="用于调转的URL，支持带http://的URL或U函数参数格式"
                           autocomplete="off" value="{$info.url|default=''}"
                           class="layui-input ">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">新窗口打开</label>
                <div class="layui-input-block">
                    <input type="radio" name="target" value="1" title="是">
                    <input type="radio" name="target" value="0" title="否">
                </div>
                <div class="layui-form-mid layui-word-aux">是否新窗口打开链接</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">优先级</label>
                <div class="layui-input-block">
                    <input type="text" name="sort" placeholder="导航显示顺序" lay-verify="required|number"
                           value="{$info.sort ?? ''}"
                           class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <input type="hidden" name="pid" value="{$info.pid ?? 0}">
                    <input type="hidden" name="id" value="{$info.id ?? 0}">
                    <button class="layui-btn" lay-submit="" lay-filter="channel">立即提交</button>
                    <button class="layui-btn layui-btn-primary retreat">取消</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    UrlHighlight("{:Url::build('Channel/index')}");
    setChoose("target", "{$info.target ?? 0}");
    //监听提交
    layui.use(['jquery', 'form', 'layer'], function () {
        layui.form.on('submit(channel)', function (data) {
            layui.$.post(data.form.action, data.field, function (info) {
                status_load(info, data.elem);
            })
            return false;
        });
    })
</script>
{/block}